From 1e56ea4a43c013b779b7a7f0d8e214c8e2801d07 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sat, 3 Dec 2005 21:53:01 +0100 Subject: [PATCH] Fix request-notification holdoff in blkback. New code is more correct and clearer in intent. Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c index f689dd0662..fcc6c12de4 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c @@ -483,23 +483,22 @@ static void make_response(blkif_t *blkif, unsigned long id, blkif_back_ring_t *blk_ring = &blkif->blk_ring; int notify; - /* Place on the response ring for the relevant domain. */ spin_lock_irqsave(&blkif->blk_ring_lock, flags); + + /* Place on the response ring for the relevant domain. */ resp = RING_GET_RESPONSE(blk_ring, blk_ring->rsp_prod_pvt); resp->id = id; resp->operation = op; resp->status = st; blk_ring->rsp_prod_pvt++; RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(blk_ring, notify); - spin_unlock_irqrestore(&blkif->blk_ring_lock, flags); /* * Tail check for pending requests. Allows frontend to avoid * notifications if requests are already in flight (lower overheads * and promotes batching). */ - mb(); - if (!__on_blkdev_list(blkif)) { + if (blk_ring->rsp_prod_pvt == blk_ring->req_cons) { int more_to_do; RING_FINAL_CHECK_FOR_REQUESTS(blk_ring, more_to_do); if (more_to_do) { @@ -508,6 +507,8 @@ static void make_response(blkif_t *blkif, unsigned long id, } } + spin_unlock_irqrestore(&blkif->blk_ring_lock, flags); + if (notify) notify_remote_via_irq(blkif->irq); } -- 2.30.2